{% extends "tj3/tj3.html" %}


{% block content  %} 

<a href={% url calendar last_year,this_month %}><<</a>
{{ year }}
<a href={% url calendar next_year,this_month %}>>></a>

{% for index,name in month.items %} 
<a href={% url calendar year, index %}>
	{% if index == this_month %}
		<font color=red><u>{{name}}</u></font>
	{% else %}
		{{name}}
	{% endif %}
</a> 
{% endfor %}

<table id="calendar">
<thead>
	<th>SUN
	<th>MON
	<th>TUE
	<th>WED
	<th>THU
	<th>FRI
	<th>SAT
</thead>

<tbody>
{% for date,t_list,j_list in events %}
{% if forloop.first %}
<tr>
{% endif %}

	<td>
	{% if date %}
	<h3>{{date}}.</h3>
	{% endif %}
	
	{% if t_list|length > 0 %}
	<!--- tasks --->
	<img src="/media/icons/task.png"/ width=15px 
	height=15px><b>Tasks:</b><p> 
	{% for t in t_list %}
		<a href="{% url task_detail t.id %}">{{ t|truncatewords:2 }}</a><br>	
	{% endfor %}
	{% endif %}
		
	{% if j_list|length > 0 %}
	<!--- journals --->
	<img src="/media/icons/journal.png" width=15px height=15px 
	/><b>Journals:</b><br> 
	{% for j in j_list %}
		<a href="{% url journal_edit j.id %}">{{ j|truncatewords:2 }}</a><br>
	{% endfor %}
	{% endif %}
	
	</td>

{% if forloop.counter|divisibleby:"7" %}
	</tr>
	<tr>
{% endif %}

{% endfor %}

{% endblock content %}
